Deinitialize timers before destroying the local apic; this protects us
authorSteven Hand <steven@xensource.com>
Tue, 26 Jun 2007 11:40:37 +0000 (12:40 +0100)
committerSteven Hand <steven@xensource.com>
Tue, 26 Jun 2007 11:40:37 +0000 (12:40 +0100)
against a late firing timer callback function (e.g. hpet_timer_fn) which
tries to access local APIC state.

Signed-off-by: Steven Hand <steven@xensource.com>
xen/arch/x86/hvm/hvm.c

index 570181e5231999c8982f124b6f2b81c001db3814..2d730f6682ef6bdf6c6ee49f5b388aed9227fec1 100644 (file)
@@ -423,12 +423,6 @@ void hvm_vcpu_destroy(struct vcpu *v)
 {
     struct domain *d = v->domain;
 
-    vlapic_destroy(v);
-    hvm_funcs.vcpu_destroy(v);
-
-    /* Event channel is already freed by evtchn_destroy(). */
-    /*free_xen_event_channel(v, v->arch.hvm_vcpu.xen_port);*/
-
     if ( v->vcpu_id == 0 )
     {
         /* NB. All these really belong in hvm_domain_destroy(). */
@@ -437,6 +431,12 @@ void hvm_vcpu_destroy(struct vcpu *v)
         pmtimer_deinit(d);
         hpet_deinit(d);
     }
+
+    vlapic_destroy(v);
+    hvm_funcs.vcpu_destroy(v);
+
+    /* Event channel is already freed by evtchn_destroy(). */
+    /*free_xen_event_channel(v, v->arch.hvm_vcpu.xen_port);*/
 }